package ru.xpparty.scanner;

/**
 * Implementation of scanner.
 * Performs scan processing by request.
 * @author ruzhnikov
 *
 */
public class ScannerImpl implements Scanner {

	private SocketScannerFactory scannerFactory;

	/**
	 * 
	 * @param scannerFactory factory of socket scanners.
	 */
	public ScannerImpl(SocketScannerFactory scannerFactory) {
		this.scannerFactory = scannerFactory;
	}
	

	/**
	 * 	Performs scan processing by request.
	 */
	@Override
	public ScanResult scan(Request request) {		
		PortStatus status = scannerFactory.get(request.getHost(), request.getPort()).scan();
		return new ScanResult(request.getHost(), request.getPort(), status);
	}

}
